A LRA is very similar to a loudspeaker, but instead of a cone that generates sound waves there is a mass that generates vibrations. Depending on the mass and spring stiffness there is a certain natural resonant frequency. For most LRAs this is around 200Hz.
Now, similar to the fact that a loudspeaker can be a microphone and a microphone can be a loudspeaker, a LRA can also sense. Instead of sending small pulse to the actuator, you can setup and bias a LRA to a comparator and see if there is any voltage difference.
The chip I use is an ATtiny25 since it is cheap, low-power and has a built-in comparator.
The following sketch shows how the different components are connected.
You can change the variable resistor to make the LRA more sensitive. The closer to the reference voltage of 1.1V (internal of the comparator) the easier for the LED to be triggered.
git clone https://robinkrens.nl/repo/lra-as-sensor
- compilers and libs: avr-gcc, avr-libc and avrdude
- programmer: any avr programmer (makefile is setup for usbasp)
make make flash